<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" isELIgnored="false" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>展示图书信息</title>
		<script>
			function doDeleteById(id){
				if (window.confirm("确认要删除图书吗")){
					//这里href要加项目名
					window.location.href="${pageContext.request.contextPath}/book/deleteBook.do?id="+id
				}
			}
		</script>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/style.css" />
	</head>
	<body>
		<div id="wrap">
			<div id="top_content"> 
				<div id="header">
					<div id="rightheader">
						<p>
							2009/11/20
							<br />
						</p>
					</div>
					<div id="topheader">
						<h1 id="title">
							<a href="#">main</a> 
						</h1>
					</div>
					<div id="navigation">
					</div>
				</div>
				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						Welcome!
					</h1>
					<form method="post" action="${pageContext.request.contextPath}/book/batchDelete.do">
					<table class="table">
						<tr class="table_header">
						    <td>全选</td>
							<td>编号</td>
							<td>图书名称</td>
							<td>图书价格</td>
							<td>作者</td>
							<td>入库时间</td>
							<td>类别名称</td>
							<td>操作</td>
						</tr>

						<c:forEach items="${books}" var="book">
						<tr>
						    <td>
							   <input type="checkbox" name="ids" value="${book.id}"/>
							</td>
							<td>${book.id}</td>
							<td>${book.name}</td>
							<td>${book.price}</td>
							<td>${book.author}</td>
							<td>${book.date}</td>
							<td>${book.type.tname}</td>
							<td>
								<a href="javascript:void(0)" onclick="doDeleteById(${book.id})">删除图书</a>&nbsp;<a href="${pageContext.request.contextPath}/book/selectOne.do?id=${book.id}">修改图书</a>
							</td>
						</tr>
						</c:forEach>
					
					</table>
					  <input type="submit" value="删除勾选项"/>
					</form>
					<p>
						<a href="${pageContext.request.contextPath}/type/selectAllType.do">添加图书</a>
						<a href="${pageContext.request.contextPath}/type/selectAllTypeAndBooKNum.do">查看所有类别</a>
					</p>
				</div>
			</div>
			<div id="footer">
				<div id="footer_bg">
				ABC@126.com
				</div>
			</div>
		</div>
	</body>
</html>
